<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function* show () {
    //   console.log(1);
    //   yield '1';
    //   console.log(2);
    //   yield '2';
    //   console.log(3);
    //   yield '3';
    //   console.log(4);
    //   yield '4';
    // }
    // let it = show()
    // let obj = it.next()
    // while (!obj.done) {
    //   console.log(obj.value);
    //   obj = it.next()
    // }
    // // console.log(it.next());
    // // console.log(it.next());
    // // console.log(it.next());
    // // console.log(it.next());
    // // console.log(it.next());
    function show1 () {
      setTimeout(() => {
        console.log("1秒定时器");
      }, 1000);
    }

    function show2 () {
      setTimeout(() => {
        console.log("2秒定时器")
        it.next()
      }, 2000);
    }
    function show3 () {
      setTimeout(() => {
        console.log("3秒定时器");
        it.next()
      }, 3000);
    }

    function* test () {
      yield show3();
      yield show2();
      yield show1();
    }
    var it = test()
    it.next()




  </script>
</body>

</html>